package cn.lingyangwl.agile.common.datasource;

import cn.lingyangwl.agile.model.module.mq.AbstractMQ;
import cn.lingyangwl.agile.model.module.mq.BaseMqPayload;
import lombok.*;

/**
 * 定义MQ消息格式
 * 业务场景： 删除租户
 *
 * @author shenguangyang
 */
@Getter
@Setter
public class TenantDeleteMQ extends AbstractMQ {
    public static final String EXCHANGE = "tenant.delete";
    public static final String KEY = "";

    public TenantDeleteMQ(MsgPayload msgPayload) {
        super(msgPayload);
    }

    /**
     * 定义Msg消息载体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class MsgPayload extends BaseMqPayload {
        private Boolean isMainTenant = Boolean.FALSE;

        public MsgPayload(Boolean isMainTenant, String tenantId) {
            super();
            this.tenantId = tenantId;
            this.isMainTenant = isMainTenant;
        }
    }

    public static TenantDeleteMQ build(Boolean isMainTenant, String tenantId) {
        return new TenantDeleteMQ(new MsgPayload(isMainTenant, tenantId));
    }
}
